﻿using PHMEE.ToolKits;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PHMEE
{
    /// <summary>
    /// 加速度测点
    /// </summary>
    public class AcceleratePoint : Point
    {
        protected AcceleratePoint()
        {

        }

        public AcceleratePoint(Guid id, string name, string nameen) : base(id, name, nameen)
        {

        }

        /// <summary>
        /// 位置
        /// </summary>
        [NotMapped]
        public PointPositionEnum Position { get; set; }

        /// <summary>
        /// 方向
        /// </summary>
        [NotMapped]
        public PointDirectionEnum Direction { get; set; }


        /// <summary>
        /// 算法
        /// </summary>
        [NotMapped]
        public DiagnosisAlgEnum DiagnosisAlg { get; set; }


        public override void SerializeProperties(Dictionary<string, object> derivedPropertiesJson)
        {
            var properties = PHMEECoreHelper.GetDerivedProperties(this);
            this.DerivedPropertiesJson = derivedPropertiesJson.Where(item => properties.Keys.Any(p => string.Equals(p, item.Key, StringComparison.OrdinalIgnoreCase))).ToDictionary();
        }

        public override void DeserializeProperties()
        {
            PHMEECoreHelper.SetDerivedProperties(this, DerivedPropertiesJson);
        }
    }
}
